package cn.shadow.bean;

import cn.shadow.message.ChannelSender;
import cn.shadow.message.MessageProcessor;
import cn.shadow.moulde.IModuleObjController;
import cn.shadow.moulde.ModuleHub;
import io.netty.buffer.ByteBuf;


/**
 * 玩家所有动态数据
 */
public class PlayerModule implements MessageProcessor, IModuleObjController {

    private ChannelSender sender;
    private ModuleHub moduleHub;

    public PlayerModule(ModuleHub moduleHub, ChannelSender sender) {
        this.sender = sender;
        this.moduleHub = moduleHub;
    }

    @Override
    public void onMessage(ByteBuf byteBuf, int moduleID, int sequenceID) {
        moduleHub.dispatch(moduleID, sequenceID, byteBuf, this);
    }

    @Override
    public void sendMessage(ByteBuf buffer) {
        sender.sendMessage(buffer);
    }
}
